<template>
  <up-navbar title="阅读协议" bgColor="transparent"> </up-navbar>
  <img class="bg" src="../../static/bg.png" alt="" />
  <img class="bigIcon" src="../../static/bigIcon.png" alt="" />
  <div class="topSitting"></div>
  <div class="protocolArea">协议协议协议协议协议协议协议协议协议</div>
  <div class="agree" @click="agree">同意协议并继续</div>
  <div class="bottomSetting"></div>
</template>

<script setup>
import { ref, reactive, onMounted } from "vue";
import * as http from "../../utils/http";
import { onLoad } from "@dcloudio/uni-app";
import * as utils from "../../utils/utils";
import { useAppStore } from "../../store/index";
const store = useAppStore();

let param = null;
onLoad((options) => {
  param = JSON.parse(options.value);
  http
    .creditAuthBookPreview({
      cardName: "身份证",
      ...param,
    })
    .then((res) => {
      store.setCreditFileId(res.data.fileId);
      wx.setStorageSync('creditFileId',res.data.fileId)
      store.setCreditContractId(res.data.contractId);
      wx.setStorageSync('creditContractId',res.data.contractId)
      utils.base64ToPath(res.data.fileBase64).then((res) => {
        console.log(res); //文件临时路径
      });
    });
  http
    .personSensitiveMsgPreview({
      cardName: "身份证",
      ...param,
    })
    .then((res) => {
      store.setSensitiveFileId(res.data.fileId);
      wx.setStorageSync('sensitiveFileId',res.data.fileId)
      store.setSensitiveContractId(res.data.contractId);
      wx.setStorageSync('sensitiveContractId',res.data.contractId)
    });
});
const agree = () => {
  wx.redirectTo({
    url: "../faceFirstPage/faceFirstPage?value=" + JSON.stringify(param),
  });
};
</script>

<style scoped lang="scss">
.bg {
  width: 100%;
  height: 873rpx;
  position: absolute;
  z-index: -9999;
  left: 0;
  top: 0;
}
.bigIcon {
  width: 148rpx;
  height: 115rpx;
  position: absolute;
  z-index: -999;
  left: 533rpx;
  top: 140rpx;
}
.topSitting {
  height: 240rpx;
}
.protocolArea {
  margin: 0 28rpx;
  background-color: rgba($color: #fff, $alpha: 0.85);
  border-radius: 16rpx;
  padding: 34rpx 43rpx;
  box-shadow: 0 4rpx 12rpx 0rpx #a4c3f3;
}
.agree {
  width: 590rpx;
  height: 88rpx;
  line-height: 88rpx;
  border-radius: 44rpx;
  margin: 67rpx 80rpx;
  color: #fff;
  font-size: 32rpx;
  text-align: center;
  background-color: #3277f2;
}
.bottomSetting {
  height: 78rpx;
}
</style>
